document.addEventListener("DOMContentLoaded", function(event) { //do work });
// without jQuery (doesn't work in older IEs) document.addEventListener('DOMContentLoaded', function(){ // your code goes here }, false);